package designpattern.demo.behavioral.observerpattern;

import designpattern.demo.behavioral.observerpattern.observer.BinaryObserver;
import designpattern.demo.behavioral.observerpattern.observer.HexaObserver;
import designpattern.demo.behavioral.observerpattern.observer.OctalObserver;
import designpattern.demo.behavioral.observerpattern.observer.Subject;

public class Main {
    public static void main(String[] args) {
        Subject subject = new Subject();

        new HexaObserver(subject);
        new OctalObserver(subject);
        new BinaryObserver(subject);

        System.out.println("First state change: 15");
        subject.setState(15);
        System.out.println("Second state change: 10");
        subject.setState(10);

        System.out.println("All Observers:");
        subject.getObservers().forEach(o -> System.out.println(o));

    }
}
